function starbar(id) {
	var obj_img = document.getElementById(id).getElementsByTagName("img");
	
	for (var i = 0; i < obj_img.length; i++) {
		obj_img[i].index = i;
		
		obj_img[i].onmouseenter = function() {
			for (var j = 0; j < this.index + 1; j++) {
				obj_img[j].setAttribute("src", "img/star_full.png");
			}
		}

		obj_img[i].onmouseleave = function() {
			for (var j = 0; j < this.index + 1; j++) {
				obj_img[j].setAttribute("src", "img/star_none.png");
			}
		}

		obj_img[i].onclick = function() {
			for (var j = 0; j < 5; j++) {
				if (j <= this.index) {
					obj_img[j].setAttribute("src", "img/star_full.png");
				} else {
					obj_img[j].setAttribute("src", "img/star_none.png");
				}
				obj_img[j].onmouseenter = null;
				obj_img[j].onmouseleave = null;
			}
		}
	}
}

starbar("satisfaction");
starbar("speed");
starbar("decorate");

var evalutes = document.getElementsByClassName("evalutes")[0].getElementsByTagName("span");
for (var i = 0; i < evalutes.length; i++) {
	evalutes[i].onclick = function() {
		if (!this.hasAttribute("class")) {
			this.className += "active"
		} else {
			this.removeAttribute("class");
			return false;
		}
	}
}